<template>
  <div class="ggPage">
    <div class="ggPage-header">
      <TopAppBar :title="title">
        <slot name="topSelect"></slot>
      </TopAppBar>
    </div>
    <div class="ggPage-main">
      <div v-if="isType2 || isType3" class="ggPage-main-left">
        <slot name="left"></slot>
      </div>
      <div
        :class="{
          centerPadding1: isType1,
          centerPadding2: isType2,
          centerPadding3: isType3,
        }"
        class="ggPage-main-center"
      >
        <div class="ggPage-main-center-content">
          <slot></slot>
        </div>
      </div>
      <div v-if="isType3" class="ggPage-main-right">
        <slot name="right"></slot>
      </div>
    </div>
  </div>
</template>

<script>
/**
 * @prop { pageType } String  1:只有中间居中内容 、 2:有左侧菜单 、 3:有右侧区域
 * @prop { title } String  标题
 */
export default {
  name: `GgPage`,
  props: {
    pageType: {
      type: String,
      default: "1",
    },
    title: {
      type: String,
      default: "",
    },
  },
  computed: {
    isType1() {
      return this.pageType === "1";
    },
    isType2() {
      return this.pageType === "2";
    },
    isType3() {
      return this.pageType === "3";
    },
  },
};
</script>

<style lang="less" scoped>
.ggPage {
  box-sizing: border-box;
  height: 100vh;
  min-width: 1280px;
  min-height: 620px;
  &-header {
    height: 64px;
    /deep/.el-header {
      height: 64px !important;
    }
  }
  &-main {
    height: calc(100% - 64px);
    display: flex;
    justify-content: center;
    padding-top: 24px;
    &-left {
      width: 280px;
      flex-shrink: 0;
    }
    &-center {
      flex: 1;
      overflow-y: auto;
      &-content {
        height: 100%;
      }
    }
    .centerPadding1 {
      padding: 0 280px;
    }
    .centerPadding2 {
      padding: 0 80px 112px 32px;
    }
    .centerPadding3 {
      padding: 0 0 112px 32px;
    }
    &-right {
      width: 280px;
      flex-shrink: 0;
    }
  }
}
</style>
